converse
Initiates a voice interaction sequence: records audio from the device's microphone, sends it to a DialogFlow service for processing, and delivers the result asynchronously as a command.
When this method is called:
- The player may prompt the user or otherwise indicate that audio recording is about to begin (behavior may vary based on player configuration).
- Audio is captured from the microphone.
- The captured audio is sent to an integrated DialogFlow service.
- The response from DialogFlow (e.g., intent, entities, fulfillment text) is then dispatched as a new Command within the player system. This command will typically have the name "
dialogflow
" and its argument will be a JSON string containing the structured response from DialogFlow. Listen for this command using OnCommandListener.
Permissions: This functionality requires the android.permission.RECORD_AUDIO
permission to be declared in the application's manifest and granted by the user at runtime on Android 6.0 (API level 23) and higher.
Error Handling: If audio recording fails, network issues prevent communication with DialogFlow, or DialogFlow returns an error, the behavior can vary. A "dialogflow" command might still be issued with error details in its JSON argument, or a system-level error might be logged. Consult specific player error reporting mechanisms for details.
Return
A unique string identifier for this voice interaction attempt. This ID can be used for logging or to correlate this initiation call with the asynchronous "dialogflow" command that will eventually be dispatched. Returns null
if the interaction could not be initiated (e.g., due to configuration issues or missing permissions before starting).
See also
To receive the "dialogflow" command.
For understanding the structure of command objects. // Add link here if you have specific documentation for the "dialogflow" command's JSON structure
Throws
if the required RECORD_AUDIO
permission is not granted. (Or document how permission failures are handled if not via SecurityException)